]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Make sure the style is updated before computing the layout
authorJonas Dreßler <verdre@v0yd.nl>
Sat, 24 Nov 2018 23:57:00 +0000 (00:57 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 15 Jul 2019 23:00:34 +0000 (23:00 +0000)
In some cases the style-changed signal hasn't been emitted when
_computeLayout() is called, resulting in the use of the default spacing
and item size values for the calculations.

One case where this happens is when starting a search. Right after the
initialization of GridSearchResults, _computeLayout() is called from
_getMaxDisplayedResults() and the style-changed signal hasn't been
emitted yet. The computed layout will be wrong and the maximum
number of results will also be wrong.

To prevent this from happening, make sure the style has been updated
before doing the calculations in _computeLayout().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/110

js/ui/iconGrid.js

index 3c0bd3cd2434e9ea149928658fa4bca57dc2f2ab..9a6ddc586b3582dab529fd6b432e76dabae78141 100644 (file)
@@ -602,6 +602,8 @@ var IconGrid = GObject.registerClass({
     }
 
     _computeLayout(forWidth) {
+        this.ensure_style();
+
         let nColumns = 0;
         let usedWidth = this.leftPadding + this.rightPadding;
         let spacing = this._getSpacing();